package com.zxy.supplier_system.server.service

import com.zxy.supplier_system.server.controller.GeneralGoodsCategoryController
import com.zxy.supplier_system.server.repository.GeneralGoodsCategoryRepository
import org.springframework.stereotype.Service

@Service
class GeneralGoodsCategoryService(
    private val generalGoodsCategoryRepository: GeneralGoodsCategoryRepository,

) {

    fun findAllTree(): List<GeneralGoodsCategoryController.GeneralGoodsCategoryNodeResponse> {
        return GeneralGoodsCategoryController.GeneralGoodsCategoryNodeResponse.flatCategoriesToNodeTree(generalGoodsCategoryRepository.findAll())
    }

}